package usecase

import (
	"context"
	"demo/internal/biz/repo"
	"demo/internal/conf"
)

type UserUseCase struct {
	bc *conf.BootComponent
	cf *conf.BaseConf
	up repo.UserRepo
}

func NewUserUseCase(up repo.UserRepo, bc *conf.BootComponent, cf *conf.BaseConf) *UserUseCase {
	return &UserUseCase{
		bc: bc,
		cf: cf,
		up: up,
	}
}

func (t *UserUseCase) AddUser(ctx context.Context, uname string) error {
	if err := t.up.CreateUser(ctx, uname); err != nil {
		t.bc.Glog.Errorf(ctx, "新建用户失败,%v", err)
		return err
	}
	t.bc.Glog.Info(ctx, "hello")
	return nil
}
